﻿using System.Collections.Generic;

namespace JsValidator.Tests
{
    public class FakeReporter : IReporter
    {
        private readonly List<string> _errors = new List<string>();
        private readonly List<string> _warnings = new List<string>();

        public IEnumerable<string> Warnings
        {
            get { return _warnings; }
        }
        public IEnumerable<string> Errors
        {
            get { return _errors; }
        }

        public void Report(ReportEntryType type, string message, string filename, string lineNumber, int column)
        {
            if (type == ReportEntryType.Error)
                ReportError(message);
            else
                ReportWarning(message);
        }

        public void Report(string text, ReportEntryType type)
        {
            if (type == ReportEntryType.Error)
                ReportError(text);
            else
                ReportWarning(text);
        }

        public void ReportWarning(string text)
        {
            _warnings.Add(text);
        }

        public void ReportError(string text)
        {
            _errors.Add(text);
        }
    }
}